﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKhachSan.DTO;
using System.Data;
using System.Data.SqlClient;

namespace QLKhachSan.DAO
{
    public class DAO_PhieuDen
    {
        public static void themPhieuDen(DTO_PhieuDen p)
        {
            string[] name = new string[4] { "@MaKH","@NgayThue","@TienTraTruoc","@MaNV"};
            object[] ob = new object[4] { p.MaKH,p.NgayThue,p.TienTraTruoc,p.MaNV };
            clsKetNoi.ThucThiLenhCoTS("pr_ThemPhieuDen", name, ob, 4);
        }
        public static DataTable hienthiDanhSachPhieuDen()
        {
            return clsKetNoi.Load("pr_HienThiPhieuDen");
        }

        public static void xoaPhieuDen(DTO_PhieuDen p)
        {
            string[] name = new string[1] { "@MaPhieuDen" };
            object[] ob = new object[1] { p.MaPhieuDen };
            clsKetNoi.ThucThiLenhCoTS("pr_XoaPhieuDen", name, ob, 1);
        }
        public static DataTable hienthiDanhSachPhieuDenTheoMaPhieuDen(DTO_PhieuDen p)
        {
            string[] name = new string[1] { "@MaPhieuDen" };
            object[] ob = new object[1] { p.MaPhieuDen };
            return clsKetNoi.LoadCoTS("pr_HienThiPhieuDenTheoMaPhieu",name,ob,1);
        }       
        public static DataTable hienthiDanhSachPhieuDenDeInTheoMaPhieuDen(DTO_PhieuDen p)
        {
            string[] name = new string[1] { "@MaPhieuDen" };
            object[] ob = new object[1] { p.MaPhieuDen };
            return clsKetNoi.LoadCoTS("pr_HienThiPhieuDenDeInTheoMaPhieuDen", name, ob, 1);
        }
        
        public static DataTable HienThiMaPhieuDenTheoTenPhong(string p)
        {
            string[] name = new string[1] { "@TenPhong" };
            object[] ob = new object[1] { p };
            return clsKetNoi.LoadCoTS("pr_HienThiMaPhieuDenTheoTenPhong", name, ob, 1);
        }
    }
}
